11  Evaluated Plot

11.1 Calculation

library(lagci)
Warning in fun(libname, pkgname): mzR has been built against a different Rcpp version (1.0.14)
than is installed on your system (1.1.0). This might lead to errors
when loading mzR. If you encounter such issues, please send a report,
including the output of sessionInfo() to the Bioc support forum at 
https://support.bioconductor.org/. For details see also
https://github.com/sneumann/mzR/wiki/mzR-Rcpp-compiler-linker-issue.
── Attaching packages ────────────────────────────────────────── lagci 0.99.5 ──
✔ dplyr   1.1.4     ✔ ggplot2 3.5.2
── Conflicts ────────────────────────────────────────────── lagci_conflicts() ──
✖ methods::body<-()    masks base::body<-()
✖ dplyr::filter()      masks stats::filter()
✖ methods::kronecker() masks base::kronecker()
✖ dplyr::lag()         masks stats::lag()
data("heart_data")
data("step_data")
result <- lagci::calculate_lagged_correlation(
  y = heart_data$heart,
  x = step_data$step,
  time2 = heart_data$time,
  time1 = step_data$time,
  time_tol = 0.5,
  step = 1/60,
  align_method = "linear",
  cor_method = "spearman"
)

11.2 evaluate_lagged_cor

If evaluation fails or looks poor, ensure both series overlap sufficiently, reduce sparsity by increasing time_tol or coarsening step, and require enough matched points (e.g., raise min_matched_sample) before re-evaluating.

evaluate_lagged_cor(object = result,plot = TRUE)
$score
[1] 0.9572743

$plot